<template>
	<view class="page" :style="{'height':h+'px','padding-top':mt+'px'}">
		<c-nav-bar title="发票管理" backUrl="/pages/my/index"></c-nav-bar>
		<view class="box">
			<view class="b_title">选择类型 开具发票</view>
			<view class="b_items">
				<view class="b_item" v-for="(item,index) in typeList" :key="index" @tap="selectType(item.type)">
					<image :src="item.img"></image>
					<text>{{item.title}}</text>
				</view>
			</view>
		</view>
		<view class="box">
			<view class="b_title">发票服务</view>
			<view class="b_items fpfw">
				<view class="b_item" v-for="(item,index) in serviceList" :key="index" @tap="toTurn(item.path)">
					<image :src="item.img"></image>
					<text>{{item.title}}</text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				h: uni.getSystemInfoSync().windowHeight,
				mt: uni.getSystemInfoSync().statusBarHeight + 44,
				typeList: [
					{
						type: 2,
						img: 'https://i.ringzle.com/file/20240523/8d1b21e4b2e740e7b7f871748e20bde9.png',
						title: '船票'
					},
					{
						type: 3,
						img: 'https://i.ringzle.com/file/20240523/9a054018975d4dbfb372125d9dbc4060.png',
						title: '酒店民宿'
					},
					{
						type: 4,
						img: 'https://fsy.shengsi.gov.cn/file/20240722/32b4efbe5c984dff8f19b58c71c29f9f.png',
						title: '开票管理'
					},
					{
						type: 5,
						img: 'https://fsy.shengsi.gov.cn/file/20240724/79f4c2e071f94484b6a197ef53f59be1.png',
						title: '渔家乐'
					}
				],
				serviceList: [{
						img: 'https://i.ringzle.com/file/20240523/7bdd1906078f436d980f1323900a3c3c.png',
						title: '开票记录',
						path: '/pagesMy/invoice/record'
					},
					{
						img: 'https://i.ringzle.com/file/20240523/3b9366043cfd4c17a172a64a9f1c52ea.png',
						title: '常用发票抬头',
						path: '/pagesMy/invoice/regularLetterhead'
					}
				],
			}
		},
		methods: {
			selectType(type) {
				let url = '/pagesMy/invoice/selectOrder?type=' + type;
				if(type==2) url = '/pagesMy/invoice/webview';
				if(type==4) url = '/pagesMy/invoice/kfp';
				if(type==5) url = '/pagesMy/invoice/kfp?type=yjl';
				uni.navigateTo({
					url
				})
			},
			confirm() {
				this.show = false
			},
			toTurn(url) {
				uni.navigateTo({
					url
				});
			}
		}
	}
</script>

<style scoped lang="less">
	.page {
		width: 100%;
		padding: 0 24rpx;
		box-sizing: border-box;
		background: #F5F8FA;
		overflow-y: auto;

		.box {
			width: 100%;
			padding: 40rpx 26rpx;
			box-sizing: border-box;
			background: #FFFFFF;
			border-radius: 16rpx;
			border: 4rpx solid #FFFFFF;
			margin-top: 20rpx;

			.b_title {
				font-size: 32rpx;
				font-family: PingFang-SC, PingFang-SC;
				font-weight: bold;
				color: #333333;
			}

			.b_items {
				display: flex;
				flex-wrap: wrap;

				.b_item {
					width: 25%;
					margin-top: 48rpx;
					display: flex;
					flex-direction: column;
					align-items: center;

					image {
						width: 64rpx;
						height: 64rpx;
					}

					text {
						font-size: 26rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #111111;
						margin-top: 20rpx;
						text-align: center;
					}
				}

				&.fpfw {
					image {
						width: 48rpx;
						height: 48rpx;
					}
				}
			}
		}
	}
</style>